﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PessModel;
using System.Web.Security;

namespace PessMvc.Controllers
{
    [Authorize]
    public class ReportController : Controller
    {
        //
        // GET: /Report/
        //public void ScoreReport()
        //{
        //    Response.Redirect("~/Reports/ArchiveScoresReportForm.aspx");
        //}
        private PESSEntities db;

        public ReportController()
        {
            db = new PESSEntities();
        }

        public ActionResult ScoreReport(int activityID)
        {
            var expertGroups=db.ExpertGroups.Where(e=>e.Subject.ActivityID==activityID);
            if (Roles.IsUserInRole("ExpertJudge"))
            {
                int? expertGroupID= db.ExpertJudges.Find(Membership.GetUser().UserName).ExpertGroupID;
                expertGroups = expertGroups.Where(g => g.ID ==expertGroupID);
            }
            ViewBag.ExpertGroupID=new SelectList(expertGroups,"ID","Callsign");
            return View();
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}
